﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace Nebular.ExpenseManagement.WebApplication.Controllers
{
    public class ControllerBase : Controller
    {
        protected IAccount GetMyAccount()
        {            
            var container = MvcApplication.Container;
            return container.GetService<IAccount>();
            //var svc = container.GetService<IApplicationService>();
            //var account = svc.GetMyAccount(
            //    container.GetService<ITenantProvider>().Tenant,
            //    User.Identity.Name);
            //return account;
        }
    }
    public interface IAccountProvider
    {
        IAccount Account
        {
            get;
        }
    }
    public class AccountProvider : IAccountProvider
    {
        readonly IAccount _account;
        public AccountProvider(ITenantProvider tenantProvider)
        {
            
        }
        public IAccount Account
        {
            get { return _account; }
        }
    }
}
